
let isPhone = function(value) {
    let mobile = /^1[3-9]\d{9}$/;
    return mobile.test(value);
};

let validate = {
    phone: function(value) {
        let mobile = /^1[3-9]\d{9}$/;
        return mobile.test(value);
    },
    validatePass: function(rule, value, callback) {
        if (value === '') {
            callback(new Error('请填写手机号'));
        } else {
            if (!isPhone(value)) {
                callback(new Error('请填写正确的手机号'));
            } else {
                callback();
            }
        }
    }
}

export default validate;